import Mock from 'mockjs'
const Random = Mock.Random

// mock需要给三个参数,url(与axios请求是传的url一致,我这个是本地启动的项目就直接用本地域名了)
// 请求类型: get post...其他看文档
// 数据处理函数,函数需要return数据
Mock.mock('/test/list', 'get', () => {
  let citys = []
  for (let i = 0; i < 10; i++) {
    let obj = {
      id: i+1,
      city: Random.city(),
      color: Random.color()
    }
    citys.push(obj)
  }
  return {cityList: citys}
})



Mock.mock('/test/getTabList', 'get', () => {
  let list = []
  for (let i = 0; i < 6; i++) {
    let obj = {
      html: 'slider'+i,
      style: {
        'background':Random.color(),
        'width': '800px'
      }
    }
    list.push(obj)
  }
  return {someList: list}
})



Mock.mock('/test/getTop8', 'get', () => {
  let list = []
  for (let i = 0; i < 8; i++) {
    let obj = {
      img:Random.image('170x116',Random.color()),
      title: '标题标题标题标题标题标题标题标标题标题标'+i,
    }
    list.push(obj)
  }
  return {list: list}
})
